using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient; 
namespace HermesPortal.Core
{
    #region Chapter
    /// <summary>
    /// This object represents the properties and methods of a Chapter.
    /// </summary>
    public class Chapter
    {
        protected int _id;
        protected int _sagaID;
        protected string _title = String.Empty;
        protected string _header = String.Empty;
        protected string _footer = String.Empty;
        protected int _startMonth;
        protected int _startYear;
        protected int _endMonth;
        protected int _endYear;
        protected int _ownerID;
        protected int _viewOrder;
        protected int _creatorID;
        protected int _accessType;
        protected DateTime _lastUpdated;
        protected DateTime _createdDate;
        protected bool _isPrivate;
        protected List<Section> sections; 
        public Chapter()
        {
        }

       

        internal Chapter(SqlDataReader reader)
        {
            this.LoadFromReader(reader);
        }

        protected void LoadFromReader(SqlDataReader reader)
        {
            if (reader != null && !reader.IsClosed)
            {
                _id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) _sagaID = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) _title = reader.GetString(2);
                if (!reader.IsDBNull(3)) _header = reader.GetString(3);
                if (!reader.IsDBNull(4)) _footer = reader.GetString(4);
                if (!reader.IsDBNull(5)) _startMonth = reader.GetInt32(5);
                if (!reader.IsDBNull(6)) _startYear = reader.GetInt32(6);
                if (!reader.IsDBNull(7)) _endMonth = reader.GetInt32(7);
                if (!reader.IsDBNull(8)) _endYear = reader.GetInt32(8);
                if (!reader.IsDBNull(9)) _ownerID = reader.GetInt32(9);
                if (!reader.IsDBNull(10)) _viewOrder = reader.GetInt32(10);
                if (!reader.IsDBNull(11)) _creatorID = reader.GetInt32(11);
                if (!reader.IsDBNull(12)) _accessType = reader.GetInt32(12);
                if (!reader.IsDBNull(13)) _isPrivate = reader.GetBoolean(13);
                if (!reader.IsDBNull(14)) _lastUpdated = reader.GetDateTime(14);
                if (!reader.IsDBNull(15)) _createdDate = reader.GetDateTime(15);


            }

        }

        #region Public Properties
        public int Id
        {
            get { return _id; }
        }

        public int SagaID
        {
            get { return _sagaID; }
            set { _sagaID = value; }
        }

        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        public string Header
        {
            get { return _header; }
            set { _header = value; }
        }

        public string Footer
        {
            get { return _footer; }
            set { _footer = value; }
        }

        public int StartMonth
        {
            get { return _startMonth; }
            set { _startMonth = value; }
        }

        public int StartYear
        {
            get { return _startYear; }
            set { _startYear = value; }
        }

        public int EndMonth
        {
            get { return _endMonth; }
            set { _endMonth = value; }
        }

        public int EndYear
        {
            get { return _endYear; }
            set { _endYear = value; }
        }

        public int OwnerID
        {
            get { return _ownerID; }
            set { _ownerID = value; }
        }

        public int ViewOrder
        {
            get { return _viewOrder; }
            set { _viewOrder = value; }
        }

        public int CreatorID
        {
            get { return _creatorID; }
            set { _creatorID = value; }
        }

        public int AccessType
        {
            get { return _accessType; }
            set { _accessType = value; }
        }

        public DateTime LastUpdated
        {
            get { return _lastUpdated; }
        }

        public DateTime CreatedDate
        {
            get { return _createdDate; }
        }

        public bool IsPrivate
        {
            get { return _isPrivate; }
            set { _isPrivate = value; }
        }

      
        #endregion


     
     
    }
    #endregion

}
